package edu.ccut.saturn.basecomponent.xmloperationcomponent;

import org.dom4j.Element;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;

public class GetElementByXpath extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		
		Element root = (Element)parameterContext.getParameterValue(0);
		
		if (root != null){
			
			String xpath = (String)parameterContext.getParameterValue(1);
			
			parameterContext.setParameter(2, root.element(xpath));
			
			parameterContext.setParameter(3, root.getText());
			
		}
	}
}